package com.ruoyi.web.controller.bussiness;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.bussiness.domain.TAiQuantArbitrages;
import com.ruoyi.bussiness.service.ITAiQuantArbitragesService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * AI量化套利Controller
 * 
 * @author ruoyi
 * @date 2025-07-16
 */
@RestController
@RequestMapping("/bussiness/arbitrages")
public class TAiQuantArbitragesController extends BaseController
{
    @Autowired
    private ITAiQuantArbitragesService tAiQuantArbitragesService;

    /**
     * 查询AI量化套利列表
     */
    @PreAuthorize("@ss.hasPermi('bussiness:arbitrages:list')")
    @GetMapping("/list")
    public TableDataInfo list(TAiQuantArbitrages tAiQuantArbitrages)
    {
        startPage();
        List<TAiQuantArbitrages> list = tAiQuantArbitragesService.selectTAiQuantArbitragesList(tAiQuantArbitrages);
        return getDataTable(list);
    }

    /**
     * 导出AI量化套利列表
     */
    @PreAuthorize("@ss.hasPermi('bussiness:arbitrages:export')")
    @Log(title = "AI量化套利", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TAiQuantArbitrages tAiQuantArbitrages)
    {
        List<TAiQuantArbitrages> list = tAiQuantArbitragesService.selectTAiQuantArbitragesList(tAiQuantArbitrages);
        ExcelUtil<TAiQuantArbitrages> util = new ExcelUtil<TAiQuantArbitrages>(TAiQuantArbitrages.class);
        util.exportExcel(response, list, "AI量化套利数据");
    }

    /**
     * 获取AI量化套利详细信息
     */
    @PreAuthorize("@ss.hasPermi('bussiness:arbitrages:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(tAiQuantArbitragesService.selectTAiQuantArbitragesById(id));
    }

    /**
     * 新增AI量化套利
     */
    @PreAuthorize("@ss.hasPermi('bussiness:arbitrages:add')")
    @Log(title = "AI量化套利", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TAiQuantArbitrages tAiQuantArbitrages)
    {
        return toAjax(tAiQuantArbitragesService.insertTAiQuantArbitrages(tAiQuantArbitrages));
    }

    /**
     * 修改AI量化套利
     */
    @PreAuthorize("@ss.hasPermi('bussiness:arbitrages:edit')")
    @Log(title = "AI量化套利", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TAiQuantArbitrages tAiQuantArbitrages)
    {
        return toAjax(tAiQuantArbitragesService.updateTAiQuantArbitrages(tAiQuantArbitrages));
    }

    /**
     * 删除AI量化套利
     */
    @PreAuthorize("@ss.hasPermi('bussiness:arbitrages:remove')")
    @Log(title = "AI量化套利", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(tAiQuantArbitragesService.deleteTAiQuantArbitragesByIds(ids));
    }
}
